package huawei.widget;

import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Path.Direction;
import android.graphics.Rect;
import android.graphics.Region.Op;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.os.Build.VERSION;
import android.text.Layout;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.MeasureSpec;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.MarginLayoutParams;
import android.view.WindowInsets;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;
import com.huawei.hwphy2d.physical.util.BarrierParameters;
import huawei.android.widget.DecouplingUtil.ReflectUtil;
import huawei.hwanimation.CubicBezierInterpolator;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import o.fmz;
import o.fna;
import o.fpo;
import o.fpy;
import o.fqf.j;
import o.fqh;
import o.gg;

public class HwBottomNavigationView extends LinearLayout {
    private int ʻ;
    private boolean ʻॱ;
    private MenuInflater ʼ;
    private float ʼॱ;
    private int ʽ;
    private int ʽॱ;
    private int ʾ;
    private int ʿ;
    private int ˈ;
    private Resources ˉ;
    private final Rect ˊ;
    private fpy ˊˊ;
    private Drawable ˊˋ;
    private int ˊॱ;
    private fpo ˊᐝ;
    private Context ˋ;
    private boolean ˋˊ;
    private fna ˋˋ;
    private int ˋॱ;
    private b ˋᐝ;
    private fmz ˍ;
    private int ˎ;
    private int ˏ;
    private int ˏॱ;
    private d ͺ;
    private Menu ॱ;
    private e ॱˊ;
    private boolean ॱˋ;
    private boolean ॱˎ;
    private int ॱॱ;
    private boolean ॱᐝ;
    private int ᐝ;
    private int ᐝॱ;

    class a extends Drawable {
        private int ʻ;
        private ValueAnimator ʼ;
        private ValueAnimator ʽ;
        private Drawable ˊ;
        private int ˊॱ;
        private Context ˋ;
        private AnimatorUpdateListener ˋॱ;
        final /* synthetic */ HwBottomNavigationView ˎ;
        private int ˏ;
        private int ͺ;
        private Drawable ॱ;
        private Path ॱˊ;
        private Rect ॱॱ;
        private int ᐝ;

        a(HwBottomNavigationView hwBottomNavigationView, Context context, Drawable drawable) {
            this(hwBottomNavigationView, context, drawable, 0);
        }

        a(final HwBottomNavigationView hwBottomNavigationView, Context context, Drawable drawable, int i) {
            this.ˎ = hwBottomNavigationView;
            this.ˏ = 0;
            this.ˋ = context;
            this.ʻ = context.getResources().getInteger(o.fqf.b.ˎ);
            if (i == 0) {
                this.ᐝ = context.getResources().getDimensionPixelSize(o.fqf.a.ˋ);
            } else {
                this.ᐝ = i;
            }
            this.ॱॱ = new Rect(0, 0, this.ᐝ, this.ᐝ);
            ˋ(drawable);
            this.ˋॱ = new AnimatorUpdateListener(this) {
                final /* synthetic */ a ॱ;

                public void onAnimationUpdate(ValueAnimator valueAnimator) {
                    Object animatedValue = valueAnimator.getAnimatedValue();
                    if (animatedValue != null && (animatedValue instanceof Integer)) {
                        this.ॱ.ˏ(((Integer) animatedValue).intValue());
                    }
                }
            };
            this.ॱˊ = new Path();
            ˎ();
        }

        private void ˎ() {
            TimeInterpolator cubicBezierInterpolator = new CubicBezierInterpolator(0.4f, 0.0f, BarrierParameters.FRICTION, 1.0f);
            TimeInterpolator cubicBezierInterpolator2 = new CubicBezierInterpolator(BarrierParameters.FRICTION, 0.0f, BarrierParameters.FRICTION, 1.0f);
            this.ʼ = ValueAnimator.ofInt(new int[]{0, (int) (((float) this.ᐝ) * 1.42f)});
            this.ʼ.setDuration((long) this.ʻ);
            this.ʼ.addUpdateListener(this.ˋॱ);
            this.ʼ.setInterpolator(cubicBezierInterpolator2);
            this.ʽ = ValueAnimator.ofInt(new int[]{(int) (((float) this.ᐝ) * 1.42f), 0});
            this.ʽ.setDuration((long) this.ʻ);
            this.ʽ.addUpdateListener(this.ˋॱ);
            this.ʽ.setInterpolator(cubicBezierInterpolator);
        }

        public void draw(Canvas canvas) {
            this.ॱˊ.reset();
            this.ॱˊ.addCircle((float) (this.ˎ.ˏ() ? this.ᐝ : this.ॱॱ.left), (float) this.ॱॱ.bottom, (float) this.ˏ, Direction.CCW);
            canvas.save();
            canvas.clipPath(this.ॱˊ, Op.DIFFERENCE);
            this.ॱ.draw(canvas);
            canvas.restore();
            canvas.save();
            canvas.clipPath(this.ॱˊ);
            this.ˊ.draw(canvas);
            canvas.restore();
        }

        public void setAlpha(int i) {
            if (this.ॱ != null) {
                this.ॱ.setAlpha(i);
            }
            if (this.ˊ != null) {
                this.ˊ.setAlpha(i);
            }
        }

        public void setColorFilter(ColorFilter colorFilter) {
            if (this.ॱ != null) {
                this.ॱ.setColorFilter(colorFilter);
            }
            if (this.ˊ != null) {
                this.ˊ.setColorFilter(colorFilter);
            }
        }

        public int getOpacity() {
            if (this.ॱ != null) {
                return this.ॱ.getOpacity();
            }
            return -3;
        }

        void ˎ(int i) {
            this.ᐝ = i;
            this.ॱॱ.set(0, 0, i, i);
            this.ʼ.setIntValues(new int[]{0, (int) (((float) this.ᐝ) * 1.42f)});
            this.ʽ.setIntValues(new int[]{(int) (((float) this.ᐝ) * 1.42f), 0});
            if (this.ॱ != null) {
                this.ॱ.setBounds(this.ॱॱ);
            }
            if (this.ˊ != null) {
                this.ˊ.setBounds(this.ॱॱ);
            }
            invalidateSelf();
        }

        void ˎ(Drawable drawable) {
            ˋ(drawable);
        }

        private void ˋ(Drawable drawable) {
            if (drawable instanceof StateListDrawable) {
                Drawable stateDrawable;
                Drawable drawable2;
                StateListDrawable stateListDrawable = (StateListDrawable) drawable;
                int identifier = this.ˋ.getResources().getIdentifier("state_selected", "attr", "android");
                int[] iArr = new int[0];
                int[] iArr2 = new int[]{identifier};
                int[] iArr3 = new int[]{identifier ^ -1};
                int findStateDrawableIndex;
                if (VERSION.SDK_INT >= 29) {
                    identifier = stateListDrawable.findStateDrawableIndex(iArr3);
                    if (identifier != -1) {
                        stateDrawable = stateListDrawable.getStateDrawable(identifier);
                    } else {
                        stateDrawable = null;
                    }
                    findStateDrawableIndex = stateListDrawable.findStateDrawableIndex(iArr2);
                    if (findStateDrawableIndex != -1) {
                        drawable2 = stateDrawable;
                        stateDrawable = stateListDrawable.getStateDrawable(findStateDrawableIndex);
                    }
                    drawable2 = stateDrawable;
                    stateDrawable = null;
                } else {
                    identifier = ˎ(stateListDrawable, iArr3);
                    if (identifier != -1) {
                        stateDrawable = ॱ(stateListDrawable, identifier);
                    } else {
                        stateDrawable = null;
                    }
                    findStateDrawableIndex = ˎ(stateListDrawable, iArr2);
                    if (findStateDrawableIndex != -1) {
                        drawable2 = stateDrawable;
                        stateDrawable = ॱ(stateListDrawable, findStateDrawableIndex);
                    }
                    drawable2 = stateDrawable;
                    stateDrawable = null;
                }
                if (drawable2 == null && stateDrawable == null) {
                    ॱ(drawable, drawable.getConstantState().newDrawable().mutate());
                    return;
                } else if (drawable2 == null || stateDrawable == null) {
                    int ˎ = ˎ(stateListDrawable, iArr);
                    if (ˎ != -1) {
                        Drawable ॱ;
                        if (drawable2 == null) {
                            drawable2 = ॱ(stateListDrawable, ˎ);
                        }
                        if (stateDrawable == null) {
                            ॱ = ॱ(stateListDrawable, ˎ);
                        } else {
                            ॱ = stateDrawable;
                        }
                        ॱ(drawable2, ॱ);
                        return;
                    }
                    throw new IllegalArgumentException("no resource available to provide");
                } else {
                    ॱ(drawable2, stateDrawable);
                    return;
                }
            }
            ॱ(drawable, drawable.getConstantState().newDrawable().mutate());
        }

        private Drawable ॱ(StateListDrawable stateListDrawable, int i) {
            Object callMethod = ReflectUtil.callMethod(stateListDrawable, "getStateDrawable", new Class[]{Integer.TYPE}, new Object[]{Integer.valueOf(i)}, StateListDrawable.class);
            if (callMethod != null) {
                return (Drawable) callMethod;
            }
            return null;
        }

        private int ˎ(StateListDrawable stateListDrawable, int[] iArr) {
            Object callMethod = ReflectUtil.callMethod(stateListDrawable, "getStateDrawableIndex", new Class[]{iArr.getClass()}, new Object[]{iArr}, StateListDrawable.class);
            if (callMethod != null) {
                return ((Integer) callMethod).intValue();
            }
            return -1;
        }

        private void ॱ(Drawable drawable, Drawable drawable2) {
            if (drawable != null && drawable2 != null) {
                this.ॱ = drawable;
                this.ॱ.setBounds(this.ॱॱ);
                this.ˊ = drawable2;
                this.ˊ.setBounds(this.ॱॱ);
                invalidateSelf();
            }
        }

        private void ˏ(int i) {
            this.ˏ = i;
            invalidateSelf();
        }

        void ॱ(int i) {
            if (this.ˊ != null) {
                this.ˊॱ = i;
                if (VERSION.SDK_INT < 21) {
                    this.ˊ = gg.ʻ(this.ˊ).mutate();
                    gg.ॱ(this.ˊ, this.ˊॱ);
                } else {
                    this.ˊ.setTint(this.ˊॱ);
                }
                invalidateSelf();
            }
        }

        void ˊ(int i) {
            if (this.ॱ != null) {
                this.ͺ = i;
                if (VERSION.SDK_INT < 21) {
                    this.ॱ = gg.ʻ(this.ॱ).mutate();
                    gg.ॱ(this.ॱ, this.ͺ);
                } else {
                    this.ॱ.setTint(this.ͺ);
                }
                invalidateSelf();
            }
        }

        private void ˎ(boolean z) {
            ValueAnimator valueAnimator = z ? this.ʽ : this.ʼ;
            ValueAnimator valueAnimator2 = z ? this.ʼ : this.ʽ;
            if (valueAnimator.isRunning()) {
                valueAnimator.reverse();
            } else {
                valueAnimator2.start();
            }
        }

        void ˎ(boolean z, boolean z2) {
            if (z2) {
                ˎ(z);
            } else {
                ˏ(z ? (int) (((float) this.ᐝ) * 1.42f) : 0);
            }
        }
    }

    class b {
        final /* synthetic */ HwBottomNavigationView ˊ;
        private int ˋ;
        private int ˏ;

        b(HwBottomNavigationView hwBottomNavigationView) {
            this.ˊ = hwBottomNavigationView;
        }

        int ˋ() {
            return this.ˋ;
        }

        void ˏ(int i) {
            this.ˋ = i;
        }

        int ˎ() {
            return this.ˏ;
        }

        void ˊ(int i) {
            this.ˏ = i;
        }

        void ˏ() {
            this.ˋ = 0;
            this.ˏ = 0;
        }
    }

    class c extends LinearLayout {
        private HwTextView ʻ;
        private a ʻॱ;
        private ImageView ʼ;
        private int ʼॱ;
        private ImageView ʽ;
        private int ʽॱ;
        private int ʾ;
        private int ʿ;
        private int ˈ;
        private int ˉ;
        float ˊ;
        private boolean ˊˊ;
        private int ˊˋ;
        private MenuItem ˊॱ;
        private int ˊᐝ;
        final /* synthetic */ HwBottomNavigationView ˋ;
        private int ˋˊ;
        private boolean ˋˋ;
        private boolean ˋॱ;
        private Paint ˋᐝ;
        private int ˌ;
        private boolean ˍ;
        float ˎ;
        private boolean ˎˎ;
        private boolean ˎˏ = true;
        boolean ˏ;
        private int ˏˎ;
        private int ˏˏ;
        private int ˏॱ;
        private int ˑ;
        private int ͺ;
        private int ͺॱ;
        private Context ॱ;
        private int ॱˊ;
        private a ॱˋ;
        private int ॱˎ;
        private LinearLayout ॱॱ;
        private a ॱᐝ;
        private ImageView ᐝ;
        private a ᐝॱ;

        c(HwBottomNavigationView hwBottomNavigationView, Context context, MenuItem menuItem, boolean z, int i) {
            this.ˋ = hwBottomNavigationView;
            super(context);
            this.ॱ = context;
            this.ˊॱ = menuItem;
            inflate(context, o.fqf.d.ˊ, this);
            this.ʻ = (HwTextView) findViewById(o.fqf.e.ˏ);
            this.ʼ = (ImageView) findViewById(o.fqf.e.ˊ);
            this.ʽ = (ImageView) findViewById(o.fqf.e.ˋ);
            this.ᐝ = (ImageView) findViewById(o.fqf.e.ˎ);
            this.ॱॱ = (LinearLayout) findViewById(o.fqf.e.ॱ);
            this.ᐝॱ = new a(hwBottomNavigationView, context, this.ˊॱ.getIcon());
            this.ॱˋ = new a(hwBottomNavigationView, context, this.ˊॱ.getIcon());
            this.ʿ = hwBottomNavigationView.ˉ.getDimensionPixelSize(o.fqf.a.ˏ);
            this.ʾ = hwBottomNavigationView.ˉ.getDimensionPixelSize(o.fqf.a.ॱ);
            this.ˈ = hwBottomNavigationView.ˉ.getInteger(o.fqf.b.ˊ);
            this.ʼॱ = hwBottomNavigationView.ˉ.getInteger(o.fqf.b.ॱ);
            this.ʽॱ = hwBottomNavigationView.ˉ.getInteger(o.fqf.b.ˏ);
            this.ˋˊ = hwBottomNavigationView.ˉ.getInteger(o.fqf.b.ˋ);
            this.ˉ = hwBottomNavigationView.ˉ.getDimensionPixelSize(o.fqf.a.ʽ);
            this.ˊᐝ = hwBottomNavigationView.ˉ.getDimensionPixelSize(o.fqf.a.ˊ);
            this.ˊˋ = hwBottomNavigationView.ˉ.getDimensionPixelSize(o.fqf.a.ʻ);
            this.ˏˏ = hwBottomNavigationView.ˉ.getDimensionPixelSize(o.fqf.a.ˏॱ);
            this.ˑ = hwBottomNavigationView.ˉ.getDimensionPixelSize(o.fqf.a.ॱॱ);
            this.ͺॱ = hwBottomNavigationView.ˉ.getDimensionPixelSize(o.fqf.a.ͺ);
            this.ˏˎ = hwBottomNavigationView.ˉ.getDimensionPixelSize(o.fqf.a.ᐝ);
            this.ˌ = hwBottomNavigationView.ˉ.getDimensionPixelSize(o.fqf.a.ˎ);
            this.ʻ.setAutoTextInfo(this.ˋˊ, this.ʽॱ, 1);
            this.ˋॱ = z;
            this.ॱˎ = i;
            this.ʽ.setImageDrawable(this.ᐝॱ);
            this.ʼ.setImageDrawable(this.ॱˋ);
            this.ˋᐝ = new Paint();
            this.ˋᐝ.setAntiAlias(true);
            setOrientation(1);
            ˋ(true, true);
        }

        c ˋ(int i) {
            this.ˏॱ = i;
            ˋ(false, true);
            return this;
        }

        c ˊ(int i) {
            this.ͺ = i;
            ˋ(false, true);
            return this;
        }

        int ˎ() {
            return this.ॱˎ;
        }

        void ˊ(boolean z, boolean z2) {
            if (this.ˋˋ) {
                this.ˊˊ = z;
                this.ॱᐝ.ˎ(this.ˊˊ, false);
            } else if (z != this.ˊˊ) {
                this.ˊˊ = z;
                this.ʻॱ = this.ˋॱ ? this.ᐝॱ : this.ॱˋ;
                this.ʻॱ.ˎ(this.ˊˊ, z2);
                this.ʻ.setTextColor(this.ˊˊ ? this.ˏॱ : this.ͺ);
            }
        }

        void ˏ(boolean z) {
            if (z != this.ˋॱ) {
                this.ˋॱ = z;
            }
            if (this.ˋˋ) {
                ᐝ();
            } else {
                ˋ(true, false);
            }
        }

        private void ˋ(boolean z, boolean z2) {
            if (z) {
                MarginLayoutParams marginLayoutParams;
                if (this.ˋॱ) {
                    setGravity(17);
                    setMinimumHeight(this.ʿ);
                    setPadding(this.ˊᐝ, 0, this.ˊᐝ, 0);
                    this.ʼ.setVisibility(8);
                    this.ʽ.setVisibility(0);
                    marginLayoutParams = (MarginLayoutParams) this.ʻ.getLayoutParams();
                    marginLayoutParams.setMargins(0, 0, 0, 0);
                    this.ʻ.setLayoutParams(marginLayoutParams);
                    this.ʻ.setAutoTextSize(1, (float) this.ʼॱ);
                    this.ʻ.setGravity(8388611);
                    this.ʻॱ = this.ᐝॱ;
                } else {
                    setGravity(0);
                    setMinimumHeight(this.ʾ);
                    setPadding(0, this.ˉ + this.ˊˋ, 0, this.ˉ);
                    this.ʼ.setVisibility(0);
                    this.ʽ.setVisibility(8);
                    marginLayoutParams = (MarginLayoutParams) this.ʻ.getLayoutParams();
                    marginLayoutParams.setMargins(this.ˋ.ˋॱ, 0, this.ˋ.ˋॱ, 0);
                    this.ʻ.setLayoutParams(marginLayoutParams);
                    this.ʻ.setAutoTextSize(1, (float) this.ˈ);
                    this.ʻ.setGravity(1);
                    this.ʻॱ = this.ॱˋ;
                }
                this.ʻ.setText(this.ˊॱ.getTitle());
                this.ʻॱ.ˎ(this.ˊˊ, false);
            }
            if (z2) {
                if (this.ˎˏ) {
                    this.ᐝॱ.ॱ(this.ˏॱ);
                    this.ᐝॱ.ˊ(this.ͺ);
                    this.ॱˋ.ॱ(this.ˏॱ);
                    this.ॱˋ.ˊ(this.ͺ);
                }
                this.ʻ.setTextColor(this.ˊˊ ? this.ˏॱ : this.ͺ);
            }
        }

        void ˏ(MenuItem menuItem, boolean z) {
            this.ˋˋ = false;
            this.ˎˏ = z;
            this.ᐝ.setVisibility(8);
            this.ॱॱ.setVisibility(0);
            if (!this.ˋॱ) {
                this.ʼ.setVisibility(0);
            }
            this.ˊॱ = menuItem;
            LayoutParams layoutParams = (LayoutParams) getLayoutParams();
            layoutParams.gravity = 48;
            setLayoutParams(layoutParams);
            this.ᐝॱ.ˎ(this.ˊॱ.getIcon());
            this.ॱˋ.ˎ(this.ˊॱ.getIcon());
            ˋ(true, true);
        }

        private void ᐝ() {
            if (this.ˋॱ) {
                setMinimumHeight(this.ʿ);
                if (this.ˍ) {
                    setPadding(this.ˊᐝ, 0, this.ˊᐝ, 0);
                } else {
                    setPadding(this.ˊᐝ, this.ˉ, this.ˊᐝ, this.ˉ);
                }
            } else {
                setMinimumHeight(this.ʾ);
                if (this.ˍ) {
                    setPadding(this.ˋ.ˋॱ, 0, this.ˋ.ˋॱ, 0);
                } else {
                    setPadding(this.ˋ.ˋॱ, this.ˉ, this.ˋ.ˋॱ, this.ˉ);
                }
            }
            int ॱॱ = ॱॱ();
            ViewGroup.LayoutParams layoutParams = this.ᐝ.getLayoutParams();
            layoutParams.width = ॱॱ;
            layoutParams.height = ॱॱ;
            this.ᐝ.setLayoutParams(layoutParams);
            this.ॱᐝ.ˎ(ॱॱ);
            this.ॱᐝ.ˎ(this.ˊˊ, false);
        }

        private int ॱॱ() {
            if (!this.ˋॱ && !this.ˍ) {
                return this.ˏˏ;
            }
            if (!this.ˋॱ && this.ˍ) {
                return this.ˑ;
            }
            if (!this.ˋॱ || this.ˍ) {
                return this.ˏˎ;
            }
            return this.ͺॱ;
        }

        boolean ˊ() {
            return this.ˋˋ;
        }

        boolean ˋ() {
            return this.ˍ;
        }

        TextView ॱ() {
            return this.ʻ;
        }

        ImageView ˏ() {
            return this.ˋॱ ? this.ʽ : this.ʼ;
        }

        LinearLayout ʼ() {
            return this.ॱॱ;
        }

        boolean ʻ() {
            return this.ˎˎ;
        }

        void ॱ(boolean z) {
            this.ˎˎ = z;
            invalidate();
        }

        void ˎ(int i) {
            this.ॱˊ = i;
            this.ˋᐝ.setColor(this.ॱˊ);
            invalidate();
        }

        protected void dispatchDraw(Canvas canvas) {
            super.dispatchDraw(canvas);
            if (this.ˎˎ && !this.ˋˋ) {
                ImageView ˏ = ˏ();
                Rect rect = new Rect();
                Rect rect2 = new Rect();
                getGlobalVisibleRect(rect);
                ˏ.getGlobalVisibleRect(rect2);
                canvas.drawCircle((float) (this.ˋ.ˏ() ? (rect2.left - rect.left) + this.ˌ : (rect2.right - rect.left) - this.ˌ), (float) ((rect2.top - rect.top) + this.ˌ), (float) this.ˌ, this.ˋᐝ);
            }
        }
    }

    class d implements OnClickListener {
        private c ˎ;
        final /* synthetic */ HwBottomNavigationView ˏ;

        private d(HwBottomNavigationView hwBottomNavigationView) {
            this.ˏ = hwBottomNavigationView;
        }

        public void onClick(View view) {
            if (view instanceof c) {
                this.ˎ = (c) view;
                this.ˏ.ˊ(this.ˎ, true);
            }
        }
    }

    public interface e {
        void ˊ(MenuItem menuItem, int i);

        void ˎ(MenuItem menuItem, int i);

        void ˏ(MenuItem menuItem, int i);
    }

    public HwBottomNavigationView(Context context) {
        this(context, null);
    }

    public HwBottomNavigationView(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, 0);
    }

    public HwBottomNavigationView(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        this.ˊ = new Rect();
        this.ʽ = -16744961;
        this.ॱॱ = -1728053248;
        this.ʻ = 16394797;
        this.ˏॱ = -1;
        this.ॱˎ = false;
        this.ˊˊ = fpy.ॱ();
        this.ˋˊ = false;
        this.ˋᐝ = new b(this);
        this.ˋ = context;
        this.ˉ = context.getResources();
        this.ˋˋ = new fna(this);
        this.ˋˋ.ˎ(context, attributeSet);
        this.ˋˋ.ˎ(false);
        this.ˋˋ.ˏ(true);
        try {
            this.ॱ = (Menu) Class.forName("com.android.internal.view.menu.MenuBuilder").getConstructor(new Class[]{Context.class}).newInstance(new Object[]{context});
        } catch (ClassNotFoundException e) {
            Log.e("HwBottomNavigationView", "HwBottomNavigationView: MenuBuilder init failed");
        } catch (NoSuchMethodException e2) {
            Log.e("HwBottomNavigationView", "HwBottomNavigationView: MenuBuilder init failed");
        } catch (IllegalAccessException e3) {
            Log.e("HwBottomNavigationView", "HwBottomNavigationView: MenuBuilder init failed");
        } catch (InstantiationException e4) {
            Log.e("HwBottomNavigationView", "HwBottomNavigationView: MenuBuilder init failed");
        } catch (InvocationTargetException e5) {
            Log.e("HwBottomNavigationView", "HwBottomNavigationView: MenuBuilder init failed");
        }
        this.ʼ = new MenuInflater(this.ˋ);
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, j.ʽॱ, i, o.fqf.c.ˊ);
        this.ॱॱ = obtainStyledAttributes.getColor(j.ˋˊ, this.ॱॱ);
        this.ʽ = obtainStyledAttributes.getColor(j.ˊˋ, this.ʽ);
        this.ʻ = obtainStyledAttributes.getColor(j.ˊᐝ, this.ʻ);
        this.ˊˋ = obtainStyledAttributes.getDrawable(j.ˍ);
        this.ˏ = obtainStyledAttributes.getInteger(j.ˎˎ, 4);
        this.ˎ = obtainStyledAttributes.getColor(j.ˌ, -16777216);
        this.ॱˋ = obtainStyledAttributes.getBoolean(j.ˊˊ, false);
        int resourceId = obtainStyledAttributes.getResourceId(j.ˋᐝ, 0);
        Drawable drawable = obtainStyledAttributes.getDrawable(j.ˉ);
        obtainStyledAttributes.recycle();
        if (resourceId > 0) {
            this.ʼ.inflate(resourceId, this.ॱ);
        }
        if (drawable != null) {
            setBackground(drawable);
        }
        this.ˊᐝ = fqh.ˋ(context, i);
        this.ˋॱ = this.ˉ.getDimensionPixelSize(o.fqf.a.ʼ);
        this.ˊॱ = this.ˉ.getDimensionPixelSize(o.fqf.a.ˋ);
        this.ͺ = new d();
        ˊ();
        ˏ(this.ॱ);
    }

    private void ˊ() {
        this.ˍ = new fmz(this.ˋ);
        this.ʻॱ = false;
        this.ᐝॱ = ˋ(this.ˍ, this.ॱ.size());
        setGravity(1);
        if (!this.ॱˋ || this.ˈ <= 0) {
            this.ॱᐝ = ˋ((this.ˋ.getResources().getDisplayMetrics().widthPixels - getPaddingLeft()) - getPaddingRight());
        } else {
            this.ॱᐝ = ˋ(this.ˈ);
        }
    }

    private boolean ˋ(Menu menu) {
        return menu.size() <= 5;
    }

    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        this.ˋˋ.ˎ(getPaddingLeft(), getPaddingTop(), getPaddingRight(), getPaddingBottom());
    }

    public WindowInsets onApplyWindowInsets(WindowInsets windowInsets) {
        this.ˋˋ.ॱ(windowInsets);
        return super.onApplyWindowInsets(windowInsets);
    }

    protected void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        if (this.ʻॱ) {
            this.ᐝॱ = ˏ(this.ˍ, this.ॱ.size());
        } else {
            this.ᐝॱ = ˋ(this.ˍ, this.ॱ.size());
        }
    }

    public void setColumnEnabled(boolean z) {
        this.ॱˋ = z;
        requestLayout();
    }

    public void setPortLayout(boolean z) {
        if (this.ॱˎ != z) {
            this.ॱˎ = z;
            requestLayout();
        }
    }

    private boolean ˏ(int i, int i2, int i3, CharSequence charSequence, Drawable drawable) {
        MenuItem icon = this.ॱ.add(i, i2, i3, charSequence).setIcon(drawable);
        this.ᐝ = this.ॱ.size();
        if (this.ʻॱ) {
            this.ᐝॱ = ˏ(this.ˍ, this.ᐝ);
        } else {
            this.ᐝॱ = ˋ(this.ˍ, this.ᐝ);
        }
        ˋ(icon, this.ᐝ - 1);
        return ˋ(this.ॱ);
    }

    public boolean ˏ(CharSequence charSequence, Drawable drawable) {
        return ˏ(0, 0, 0, charSequence, drawable);
    }

    public void ॱ(CharSequence charSequence, Drawable drawable, int i, boolean z) {
        if (i >= 0 && i < this.ᐝ) {
            MenuItem item = this.ॱ.getItem(i);
            c cVar = (c) getChildAt(i);
            if (charSequence != null) {
                item.setTitle(charSequence);
            }
            if (drawable != null) {
                item.setIcon(drawable);
            }
            cVar.ˏ(item, z);
        }
    }

    public void setActiveColor(int i) {
        for (int i2 = 0; i2 < this.ᐝ; i2++) {
            ((c) getChildAt(i2)).ˋ(i);
        }
    }

    public void setDefaultColor(int i) {
        for (int i2 = 0; i2 < this.ᐝ; i2++) {
            ((c) getChildAt(i2)).ˊ(i);
        }
    }

    public void ˏ(int i, boolean z) {
        if (i < this.ᐝ) {
            ((c) getChildAt(i)).ॱ(z);
        }
    }

    public boolean ˏ(int i) {
        if (i < this.ᐝ) {
            return ((c) getChildAt(i)).ʻ();
        }
        return false;
    }

    public void setMessageBgColor(int i) {
        this.ʻ = i;
        for (int i2 = 0; i2 < this.ᐝ; i2++) {
            ((c) getChildAt(i2)).ˎ(i);
        }
    }

    private void ˏ(Menu menu) {
        this.ᐝ = menu.size();
        for (int i = 0; i < this.ᐝ; i++) {
            ˋ(menu.getItem(i), i);
        }
    }

    private void ˋ(MenuItem menuItem, int i) {
        View cVar = new c(this, this.ˋ, menuItem, this.ॱᐝ, i);
        cVar.setClickable(true);
        cVar.setBackground(fqh.ˋ(this.ˋ, this.ˊᐝ));
        cVar.ˋ(this.ʽ);
        cVar.ˊ(this.ॱॱ);
        cVar.ˎ(this.ʻ);
        cVar.setOnClickListener(this.ͺ);
        addView(cVar);
    }

    private boolean ˋ(int i) {
        float f = getResources().getDisplayMetrics().density * 104.0f;
        float f2 = ((float) i) / 5.0f;
        if (this.ॱˎ || f2 <= f) {
            return false;
        }
        return true;
    }

    private int ˋ(fmz o_fmz, int i) {
        o_fmz.ॱ(8);
        o_fmz.ˋ(this.ˋ);
        this.ʿ = o_fmz.ˊ();
        o_fmz.ॱ(9);
        o_fmz.ˋ(this.ˋ);
        this.ˈ = o_fmz.ˊ();
        return i > 3 ? this.ˈ : this.ʿ;
    }

    private int ˏ(fmz o_fmz, int i) {
        o_fmz.ॱ(8);
        o_fmz.ˊ(this.ˋ, this.ʾ, this.ʽॱ, this.ʼॱ);
        this.ʿ = o_fmz.ˊ();
        o_fmz.ॱ(9);
        o_fmz.ˊ(this.ˋ, this.ʾ, this.ʽॱ, this.ʼॱ);
        this.ˈ = o_fmz.ˊ();
        return i > 3 ? this.ˈ : this.ʿ;
    }

    private void ॱ(int i, int i2, b bVar) {
        int size = MeasureSpec.getSize(i);
        int paddingLeft = (size - getPaddingLeft()) - getPaddingRight();
        int i3 = 0;
        int paddingTop = getPaddingTop() + getPaddingBottom();
        int childMeasureSpec = getChildMeasureSpec(i2, paddingTop, -2);
        int childCount = getChildCount();
        if (childCount <= 0) {
            bVar.ˏ(size);
            bVar.ˊ(0);
            return;
        }
        if (this.ॱˋ && this.ᐝॱ > 0 && this.ᐝॱ < paddingLeft) {
            paddingLeft = this.ᐝॱ;
        }
        int i4 = paddingLeft / childCount;
        int i5 = 0;
        while (i5 < childCount) {
            View view = (c) getChildAt(i5);
            if (view.ˊ()) {
                setClipChildren(false);
                setClipToPadding(false);
                view.setClipChildren(false);
                view.setClipToPadding(false);
            } else {
                view.setClipChildren(true);
                view.setClipToPadding(true);
            }
            view.measure(MeasureSpec.makeMeasureSpec(i4, 1073741824), childMeasureSpec);
            View ʼ = view.ʼ();
            ViewGroup.LayoutParams layoutParams = ʼ.getLayoutParams();
            if (layoutParams instanceof LayoutParams) {
                MarginLayoutParams marginLayoutParams = (LayoutParams) layoutParams;
                marginLayoutParams.gravity = 17;
                ˏ(ʼ, 0, 0, marginLayoutParams);
            }
            int measuredHeight = view.getMeasuredHeight();
            if (measuredHeight <= i3) {
                measuredHeight = i3;
            }
            ˏ(view, i4);
            i5++;
            i3 = measuredHeight;
        }
        paddingLeft = i3 + paddingTop;
        bVar.ˏ(size);
        bVar.ˊ(paddingLeft);
    }

    private void ˋ(int i, int i2, b bVar) {
        int size = MeasureSpec.getSize(i);
        int paddingLeft = (size - getPaddingLeft()) - getPaddingRight();
        int childCount = getChildCount();
        if (childCount <= 0) {
            bVar.ˏ(size);
            bVar.ˊ(0);
            return;
        }
        if (this.ॱˋ && this.ᐝॱ > 0 && this.ᐝॱ < paddingLeft) {
            paddingLeft = this.ᐝॱ;
        }
        int i3 = paddingLeft / childCount;
        int paddingTop = getPaddingTop() + getPaddingBottom();
        int childMeasureSpec = getChildMeasureSpec(i2, paddingTop, -2);
        int i4 = 0;
        int i5 = 0;
        while (i5 < childCount) {
            View view = (c) getChildAt(i5);
            if (view.ˊ()) {
                view.setClipChildren(false);
                view.setClipToPadding(false);
            } else {
                view.setClipChildren(true);
                view.setClipToPadding(true);
            }
            view.measure(MeasureSpec.makeMeasureSpec(i3, 1073741824), childMeasureSpec);
            ˏ(view, i3);
            View ʼ = view.ʼ();
            ViewGroup.LayoutParams layoutParams = ʼ.getLayoutParams();
            if (layoutParams instanceof LayoutParams) {
                MarginLayoutParams marginLayoutParams = (LayoutParams) layoutParams;
                marginLayoutParams.gravity = 1;
                ʼ.setLayoutParams(marginLayoutParams);
                ˏ(ʼ, 0, 0, marginLayoutParams);
            }
            ʼ = view.ˏ();
            layoutParams = ʼ.getLayoutParams();
            if (layoutParams instanceof LayoutParams) {
                marginLayoutParams = (LayoutParams) layoutParams;
                marginLayoutParams.gravity = 1;
                ˏ(ʼ, 0, 0, marginLayoutParams);
            }
            paddingLeft = view.getMeasuredHeight();
            if (paddingLeft <= i4) {
                paddingLeft = i4;
            }
            i5++;
            i4 = paddingLeft;
        }
        paddingLeft = i4 + paddingTop;
        bVar.ˏ(size);
        bVar.ˊ(paddingLeft);
    }

    private void ˏ(List<Float> list, int i, float f, int i2, c cVar) {
        int childCount = getChildCount();
        if (i == 0 || i == childCount - 1) {
            cVar.measure(MeasureSpec.makeMeasureSpec((int) f, 1073741824), i2);
            childCount = (int) f;
        } else {
            float floatValue = ((Float) list.get(i - 1)).floatValue();
            float floatValue2 = ((Float) list.get(i + 1)).floatValue();
            if (floatValue < 0.0f || floatValue2 < 0.0f) {
                cVar.measure(MeasureSpec.makeMeasureSpec((int) f, 1073741824), i2);
                childCount = (int) f;
            } else {
                float floatValue3 = ((Float) list.get(i)).floatValue();
                if (floatValue > floatValue2) {
                    floatValue = floatValue2;
                }
                c cVar2 = (c) getChildAt(i - 1);
                c cVar3 = (c) getChildAt(i + 1);
                if (floatValue + (floatValue3 / 2.0f) > 0.0f) {
                    cVar.measure(MeasureSpec.makeMeasureSpec((int) (f - floatValue3), 1073741824), i2);
                    cVar2.ˎ = (-floatValue3) / 2.0f;
                    cVar3.ˊ = (-floatValue3) / 2.0f;
                    childCount = (int) (f - floatValue3);
                } else {
                    cVar.measure(MeasureSpec.makeMeasureSpec((int) ((2.0f * floatValue) + f), 1073741824), i2);
                    cVar2.ˎ = floatValue;
                    cVar3.ˊ = floatValue;
                    childCount = (int) ((2.0f * floatValue) + f);
                }
            }
        }
        cVar.ˏ = true;
        ˏ((View) cVar, childCount);
    }

    private void ˋ(float f, int i, List<Float> list, b bVar) {
        int childCount = getChildCount();
        int i2 = 0;
        int i3 = 0;
        while (i2 < childCount) {
            int i4;
            if (((Float) list.get(i2)).floatValue() >= 0.0f) {
                i4 = i3;
            } else {
                c cVar = (c) getChildAt(i2);
                View ˏ = cVar.ˏ();
                ViewGroup.LayoutParams layoutParams = ˏ.getLayoutParams();
                if (layoutParams instanceof LayoutParams) {
                    MarginLayoutParams marginLayoutParams = (LayoutParams) layoutParams;
                    marginLayoutParams.gravity = 1;
                    ˏ(ˏ, 0, 0, marginLayoutParams);
                }
                ॱ(cVar.ʼ(), 0, 0);
                ˏ((List) list, i2, f, i, cVar);
                i4 = cVar.getMeasuredHeight();
                if (i4 <= i3) {
                    i4 = i3;
                }
            }
            i2++;
            i3 = i4;
        }
        bVar.ˊ(i3);
    }

    private void ˏ(float f, int i, List<Float> list, b bVar) {
        int ˎ = bVar.ˎ();
        int childCount = getChildCount();
        int i2 = 0;
        while (i2 < childCount) {
            int i3;
            View view = (c) getChildAt(i2);
            if (view.ˊ()) {
                view.setClipChildren(false);
                view.setClipToPadding(false);
            } else {
                view.setClipChildren(true);
                view.setClipToPadding(true);
            }
            if (view.ˏ) {
                view.ˏ = false;
                i3 = ˎ;
            } else {
                MarginLayoutParams marginLayoutParams;
                float floatValue = ((Float) list.get(i2)).floatValue();
                View ʼ = view.ʼ();
                ViewGroup.LayoutParams layoutParams = ʼ.getLayoutParams();
                if (layoutParams instanceof LayoutParams) {
                    marginLayoutParams = (LayoutParams) layoutParams;
                    marginLayoutParams.gravity = 0;
                    ˏ(ʼ, (int) (floatValue - view.ˊ), (int) (floatValue - view.ˎ), marginLayoutParams);
                }
                View ˏ = view.ˏ();
                layoutParams = ˏ.getLayoutParams();
                if (layoutParams instanceof LayoutParams) {
                    marginLayoutParams = (LayoutParams) layoutParams;
                    marginLayoutParams.gravity = 0;
                    ˏ(ˏ, (int) (((f - ((float) this.ˊॱ)) / 2.0f) - view.ˊ), (int) (((f - ((float) this.ˊॱ)) / 2.0f) - view.ˎ), marginLayoutParams);
                }
                view.measure(MeasureSpec.makeMeasureSpec((int) ((f - view.ˊ) - view.ˎ), 1073741824), i);
                ˏ(view, (int) ((f - view.ˊ) - view.ˎ));
                view.ˊ = 0.0f;
                view.ˎ = 0.0f;
                i3 = view.getMeasuredHeight();
                if (i3 <= ˎ) {
                    i3 = ˎ;
                }
            }
            i2++;
            ˎ = i3;
        }
        bVar.ˊ(ˎ);
    }

    private void ˏ(int i, int i2, b bVar) {
        int size = MeasureSpec.getSize(i);
        float paddingLeft = (float) ((size - getPaddingLeft()) - getPaddingRight());
        bVar.ˏ(size);
        int childCount = getChildCount();
        if (childCount <= 0) {
            bVar.ˏ(size);
            bVar.ˊ(0);
            return;
        }
        int i3;
        if (this.ॱˋ && this.ᐝॱ > 0 && ((float) this.ᐝॱ) < paddingLeft) {
            paddingLeft = (float) this.ᐝॱ;
        }
        float f = paddingLeft / ((float) childCount);
        List arrayList = new ArrayList(childCount);
        for (i3 = 0; i3 < childCount; i3++) {
            ˊ(arrayList, i3, f);
        }
        i3 = getPaddingTop() + getPaddingBottom();
        int childMeasureSpec = getChildMeasureSpec(i2, i3, -2);
        ˋ(f, childMeasureSpec, arrayList, bVar);
        ˏ(f, childMeasureSpec, arrayList, bVar);
        bVar.ˊ(i3 + bVar.ˎ());
    }

    private void ˎ(int i, int i2, b bVar) {
        int childCount = getChildCount();
        int i3 = 0;
        int i4 = 0;
        for (int i5 = 0; i5 < childCount; i5++) {
            c cVar = (c) getChildAt(i5);
            i3 |= cVar.ˊ();
            i4 |= cVar.ˋ();
        }
        if (i4 != 0) {
            setClipChildren(false);
            setClipToPadding(false);
        }
        if (childCount == 2 || childCount == 1 || i3 != 0) {
            ˋ(i, i2, bVar);
        } else {
            ˏ(i, i2, bVar);
        }
    }

    protected void onMeasure(int i, int i2) {
        int i3 = 0;
        boolean z = this.ॱˋ;
        int size = MeasureSpec.getSize(i);
        int paddingLeft = (size - getPaddingLeft()) - getPaddingRight();
        int childCount = getChildCount();
        if (childCount <= 3 && this.ʿ <= 0) {
            z = false;
        }
        if (z && this.ˈ > 0 && this.ˈ < paddingLeft) {
            paddingLeft = this.ˈ;
        }
        boolean ˋ = ˋ(paddingLeft);
        if (childCount == 0) {
            setMeasuredDimension(size, 0);
            return;
        }
        if (ˋ != this.ॱᐝ) {
            this.ॱᐝ = ˋ;
            while (i3 < childCount) {
                ((c) getChildAt(i3)).ˏ(this.ॱᐝ);
                i3++;
            }
        }
        this.ˋᐝ.ˏ();
        if (this.ॱᐝ) {
            ॱ(i, i2, this.ˋᐝ);
            super.onMeasure(MeasureSpec.makeMeasureSpec(this.ˋᐝ.ˋ(), 1073741824), MeasureSpec.makeMeasureSpec(this.ˋᐝ.ˎ(), 1073741824));
            return;
        }
        ˎ(i, i2, this.ˋᐝ);
        super.onMeasure(MeasureSpec.makeMeasureSpec(this.ˋᐝ.ˋ(), 1073741824), MeasureSpec.makeMeasureSpec(this.ˋᐝ.ˎ(), 1073741824));
    }

    private void ˊ(List<Float> list, int i, float f) {
        float desiredWidth = f - (Layout.getDesiredWidth(this.ॱ.getItem(i).getTitle(), ((c) getChildAt(i)).ॱ().getPaint()) + ((float) (this.ˋॱ * 2)));
        if (desiredWidth > 0.0f) {
            list.add(Float.valueOf(desiredWidth / 2.0f));
        } else {
            list.add(Float.valueOf(desiredWidth));
        }
    }

    private void ॱ(View view, int i, int i2) {
        ˏ(view, i, i2, (MarginLayoutParams) view.getLayoutParams());
    }

    private void ˏ(View view, int i, int i2, MarginLayoutParams marginLayoutParams) {
        if (ˏ()) {
            marginLayoutParams.setMargins(i2, marginLayoutParams.topMargin, i, marginLayoutParams.bottomMargin);
        } else {
            marginLayoutParams.setMargins(i, marginLayoutParams.topMargin, i2, marginLayoutParams.bottomMargin);
        }
        view.setLayoutParams(marginLayoutParams);
    }

    private void ˏ(View view, int i) {
        ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
        layoutParams.width = i;
        view.setLayoutParams(layoutParams);
    }

    protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
        super.onLayout(z, i, i2, i3, i4);
        this.ˋˋ.ˊ(true);
    }

    public void setPadding(int i, int i2, int i3, int i4) {
        super.setPadding(i, i2, i3, i4);
        this.ˋˋ.ˎ(i, i2, i3, i4);
    }

    public void setBottomNavListener(e eVar) {
        this.ॱˊ = eVar;
    }

    public void setItemChecked(int i) {
        int childCount = getChildCount();
        if (i >= 0 && i < childCount) {
            boolean z;
            c cVar = (c) getChildAt(i);
            if (this.ˏॱ != -1) {
                z = true;
            } else {
                z = false;
            }
            cVar.ˊ(true, z);
            ˊ(cVar, false);
        }
    }

    public void ˎ() {
        this.ˏॱ = -1;
        this.ॱ.clear();
        this.ᐝ = 0;
        removeAllViews();
    }

    private void ˊ(c cVar, boolean z) {
        int ˎ = cVar.ˎ();
        if (ˎ == this.ˏॱ && this.ॱˊ != null) {
            this.ॱˊ.ˊ(this.ॱ.getItem(ˎ), ˎ);
        } else if (ˎ != this.ˏॱ) {
            if (this.ˏॱ < this.ᐝ && this.ˏॱ >= 0) {
                ((c) getChildAt(this.ˏॱ)).ˊ(false, true);
                if (this.ॱˊ != null) {
                    this.ॱˊ.ˎ(this.ॱ.getItem(this.ˏॱ), this.ˏॱ);
                }
            }
            this.ˏॱ = ˎ;
            if (z) {
                cVar.ˊ(true, true);
            }
            if (this.ॱˊ != null) {
                this.ॱˊ.ˏ(this.ॱ.getItem(this.ˏॱ), this.ˏॱ);
            }
        }
    }

    private boolean ˏ() {
        if (VERSION.SDK_INT < 17) {
            return false;
        }
        if (getLayoutDirection() == 1) {
            return true;
        }
        return false;
    }

    public void draw(Canvas canvas) {
        if (this.ˊˊ.ॱ(this)) {
            this.ˊˊ.ˊ(canvas, (View) this);
            super.dispatchDraw(canvas);
            ˊ(canvas);
            return;
        }
        super.draw(canvas);
    }

    protected void onWindowVisibilityChanged(int i) {
        super.onWindowVisibilityChanged(i);
        if (i == 0) {
            this.ˊˊ.ˋ(this, this.ˊˊ.ˋ(this.ˏ));
            this.ˊˊ.ˊ((View) this, ॱ());
            if (this.ˎ != -16777216) {
                this.ˊˊ.ˏ(this, this.ˎ);
                return;
            }
            return;
        }
        this.ˊˊ.ˏ(this);
    }

    public boolean ॱ() {
        return this.ˋˊ;
    }

    public void setBlurEnable(boolean z) {
        this.ˋˊ = z;
        this.ˊˊ.ˊ((View) this, ॱ());
    }

    protected void dispatchDraw(Canvas canvas) {
        super.dispatchDraw(canvas);
        ˊ(canvas);
    }

    private void ˊ(Canvas canvas) {
        if (this.ˊˋ != null) {
            Rect rect = this.ˊ;
            rect.left = getPaddingLeft();
            rect.right = (getRight() - getLeft()) - getPaddingRight();
            rect.top = 0;
            rect.bottom = this.ˊˋ.getIntrinsicHeight();
            this.ˊˋ.setBounds(rect);
            this.ˊˋ.draw(canvas);
        }
    }
}
